var api = require("../../utils/api.js");
Page({
  /**
   * 页面的初始数据
   */
  data: {
    statusBarNumber: 0,
    statusBar: [{
      hidden: false,
    }, {
      hidden: true,
    }, {
      hidden: true,
    }, {
      hidden: true,
    }],
    arguments: {},
    radioChange1: "no",
    radioChange2: "no",
    radioChange3: "no",
    radioChange4: "no"
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    api.client.getEnquiryRecordArgumentsByTaskIdAndUserInfoId(options.taskId, this);
    api.client.getNotarialApplicationFormArgumentsByTaskIdAndUserInfoId(options.taskId, this);
    api.client.getAcceptanceNoticeAndNotificationArgumentsByTaskIdAndUserInfoId(options.taskId, this);
    api.client.getLetterOfCommitmentArgumentsByTaskIdAndUserInfoId(options.taskId, this);
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  tab1() {
    this.changeTab(this.data.statusBarNumber, 0);
  },
  tab2() {
    this.changeTab(this.data.statusBarNumber, 1);
  },
  tab3() {
    this.changeTab(this.data.statusBarNumber, 2);
  },
  tab4() {
    this.changeTab(this.data.statusBarNumber, 3);
  },
  radioChange1(e) {
    this.setData({
      radioChange1: e.detail.value
    });
  },
  radioChange2(e) {
    this.setData({
      radioChange2: e.detail.value
    });
  },
  radioChange3(e) {
    this.setData({
      radioChange3: e.detail.value
    });
  },
  radioChange4(e) {
    this.setData({
      radioChange4: e.detail.value
    });
  },
  next() {
    if (this.data.statusBarNumber == 3) {
      if (this.data.radioChange1 == "no") {
        wx.showToast({
          title: "请第一项选是",
          icon: 'none',
          duration: 1000
        });
      } else if (this.data.radioChange2 == "no") {
        wx.showToast({
          title: "请第二项选是",
          icon: 'none',
          duration: 1000
        });
      } else if (this.data.radioChange3 == "no") {
        wx.showToast({
          title: "请第三项选知道了",
          icon: 'none',
          duration: 1000
        });
      } else if (this.data.radioChange4 == "no") {
        wx.showToast({
          title: "请第四项选知道了",
          icon: 'none',
          duration: 1000
        });
      } else {
        wx.redirectTo({
          url: "../../pages/apply3/apply3"
        });
      }
    } else {
      var next = this.data.statusBarNumber + 1;
      this.changeTab(this.data.statusBarNumber, next);
    }
  },
  changeTab(original, next) {
    this.setData({
      ["statusBar[" + original + "].background"]: "#F5F5F5",
      ["statusBar[" + original + "].color"]: "#565656",
      ["statusBar[" + original + "].border"]: "2rpx solid #D9D9D9",
      ["statusBar[" + original + "].hidden"]: true,
      ["statusBar[" + next + "].background"]: "#E6F7FF",
      ["statusBar[" + next + "].color"]: "#1890FF",
      ["statusBar[" + next + "].border"]: "2rpx solid #91D5FF",
      ["statusBar[" + next + "].hidden"]: false,
      statusBarNumber: next
    });
  }
})